package com.sheledon.flyCat.core.configuration.factory;

import com.sheledon.flyCat.core.configuration.resolver.PropertiesResolver;
import com.sheledon.flyCat.core.configuration.resolver.Resolver;
import com.sheledon.flyCat.core.configuration.resolver.YamlResolver;

/**
 * @author sheledon
 */
public class ConfigurationFileResolverFactory {
    private static final String SUFFIX_YAML ="yaml";
    private static final String SUFFIX_YML = "yml";
    private static final String SUFFIX_PROPERTIES = "properties";
    public static Resolver getResolver(String name){
        if (name.endsWith(SUFFIX_YAML) || name.endsWith(SUFFIX_YML)){
            return new YamlResolver();
        }
        if(name.endsWith(SUFFIX_PROPERTIES)){
            return new PropertiesResolver();
        }
        return null;
    }
}
